Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maven command path to maven task #1207

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mosuke5
Copy link

@mosuke5 mosuke5 commented Oct 13, 2023

Changes

In version v0.3, the path for the mvn command was set to /usr/bin/mvn. In this setup, it wasn't possible to switch to a different mvn container image or to utilize the mvnw located within the application's repository. By introducing MAVEN_COMMAND, users are now able to execute any mvn command of their choice.
Additionally, with this change, the default value for MAVEN_COMMAND is /usr/bin/mvn, ensuring compatibility with v0.3.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Follows the authoring recommendations
  • Includes docs (if user facing)
  • Includes tests (for new tasks or changed functionality)
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Commit messages follow commit message best practices
  • Has a kind label. You can add one by adding a comment on this PR that
    contains /kind <type>. Valid types are bug, cleanup, design, documentation,
    feature, flake, misc, question, tep
  • Complies with Catalog Organization TEP, see example. Note An issue has been filed to automate this validation
    • File path follows <kind>/<name>/<version>/name.yaml

    • Has README.md at <kind>/<name>/<version>/README.md

    • Has mandatory metadata.labels - app.kubernetes.io/version the same as the <version> of the resource

    • Has mandatory metadata.annotations tekton.dev/pipelines.minVersion

    • mandatory spec.description follows the convention

        ```
      
        spec:
          description: >-
            one line summary of the resource
      
            Paragraph(s) to describe the resource.
        ```
      

See the contribution guide for more details.

@tekton-robot tekton-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 13, 2023
@tekton-robot
Copy link

Hi @mosuke5. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 13, 2023
@tekton-robot
Copy link

Diff between version 0.3 and 0.4
diff --git a/task/maven/0.3/README.md b/task/maven/0.4/README.md
index bd09885..90af923 100644
--- a/task/maven/0.3/README.md
+++ b/task/maven/0.4/README.md
@@ -11,6 +11,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/maven/0.3/ra
 ## Parameters
 
 - **MAVEN_IMAGE**: The base image for maven (_default_: `gcr.io/cloud-builders/mvn`)
+- **MAVEN_COMMAND**: Maven command to execute, you could use the maven wrapper over here (_default_: `/usr/bin/mvn`)
 - **GOALS**: Maven `goals` to be executed
 - **MAVEN_MIRROR_URL**: Maven mirror url (to be inserted into ~/.m2/settings.xml)
 - **SERVER_USER**: Username to authenticate to the server (to be inserted into ~/.m2/settings.xml)
diff --git a/task/maven/0.3/maven.yaml b/task/maven/0.4/maven.yaml
index d78758a..45afbf8 100644
--- a/task/maven/0.3/maven.yaml
+++ b/task/maven/0.4/maven.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: maven
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.17.0"
     tekton.dev/categories: Build Tools
@@ -28,6 +28,10 @@ spec:
       type: string
       description: Maven base image
       default: gcr.io/cloud-builders/mvn@sha256:57523fc43394d6d9d2414ee8d1c85ed7a13460cbb268c3cd16d28cfb3859e641 #tag: latest
+    - name: MAVEN_COMMAND
+      description: Maven command to execute, you could use the maven wrapper over here.
+      type: string
+      default: "/usr/bin/mvn"
     - name: GOALS
       description: maven goals to run
       type: array
@@ -77,7 +81,7 @@ spec:
       default: "."
   steps:
     - name: mvn-settings
-      image: registry.access.redhat.com/ubi8/ubi-minimal:8.2
+      image: registry.access.redhat.com/ubi8/ubi-minimal:8.8
       script: |
         #!/usr/bin/env bash
 
@@ -146,7 +150,7 @@ spec:
     - name: mvn-goals
       image: $(params.MAVEN_IMAGE)
       workingDir: $(workspaces.source.path)/$(params.CONTEXT_DIR)
-      command: ["/usr/bin/mvn"]
+      command: ["$(params.MAVEN_COMMAND)"]
       args:
         - -s
         - $(workspaces.maven-settings.path)/settings.xml

@tekton-robot
Copy link

Catlin Output
FILE: task/maven/0.4/maven.yaml
HINT : Task: tekton.dev/v1beta1 - name: "maven" is missing a readable display name annotation("tekton.dev/displayName")
WARN : Step "mvn-settings" references "$(params.PROXY_HOST)" directly from its script block. For reliability and security, consider putting the param into an environment variable of the Step and accessing that environment variable in your script instead.
WARN : Step "mvn-goals" uses image "$(params.MAVEN_IMAGE)" that contains variables; skipping validation

Copy link
Member

@vinamra28 vinamra28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 6, 2023
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vinamra28

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants